//
//  ZSUserAccount.swift
//  ZSWeibo
//
//  Created by zsj1992 on 16/4/10.
//  Copyright © 2016年 ichange. All rights reserved.
//

import UIKit

class ZSUserAccount: NSObject {
    //用户授权的唯一票据
    var access_token: String?
    //access_token的生命周期，单位是秒数。
    var expires_in: NSTimeInterval = 0 {
        
        didSet{
            expires_date = NSDate(timeIntervalSinceNow: expires_in)
        }
       
    }

    //这样用户的属性中就多了一个真实的过期时间
    var expires_date:NSDate?
    
    //标识唯一用户的id
    var uid: String?
    //用户显示名称
    var name: String?
    //用户头像 180 * 180
    var avatar_large: String?

    init(dic:[String:AnyObject]) {
        super.init()
        self.setValuesForKeysWithDictionary(dic)
    }

    override func setValue(value: AnyObject?, forUndefinedKey key: String) {
        
    }

    override var description: String {
    
    let keys = ["access_token","avatar_large","name","expires_in","uid","expires_date"]

    let dic = self.dictionaryWithValuesForKeys(keys)
        
    return dic.description

    }
}
